class AddForeignKeys < ActiveRecord::Migration
  def self.up
    add_foreign_key(:artists, :forums, :column => :forum_id)
    add_foreign_key(:releases, :forums, :column => :forum_id)
    add_foreign_key(:songs, :forums, :column => :forum_id)
    add_foreign_key(:labels, :forums, :column => :forum_id)
    add_foreign_key(:labels, :labels, :column => :label_id)
    add_foreign_key(:editions, :releases, :column => :release_id)
    add_foreign_key(:editions, :labels, :column => :label_id)
    add_foreign_key(:threads, :forums, :column => :forum_id)
    add_foreign_key(:posts, :threads, :column => :thread_id)
  end

  def self.down
    remove_foreign_key(:artists, :column => :forum_id)
    remove_foreign_key(:releases, :column => :forum_id)
    remove_foreign_key(:songs, :column => :forum_id)
    remove_foreign_key(:labels, :column => :forum_id)
    remove_foreign_key(:labels, :column => :label_id)
    remove_foreign_key(:editions, :column => :release_id)
    remove_foreign_key(:editions, :column => :label_id)
    remove_foreign_key(:threads, :column => :forum_id)
    remove_foreign_key(:posts, :column => :thread_id)
  end
end
